﻿
using System;
using System.Collections.Generic;
using System.Data;
using DevExpress.XtraReports.UI;
using System.Data.SqlClient;
using prjKQXS_DLL;

namespace prjKQXS_UI.Lo_to
{
    public partial class frmRutThuong : DevExpress.XtraEditors.XtraForm
    {
        public frmRutThuong()
        {
            InitializeComponent();
        }

        private void frmRutThuong_Load(object sender, EventArgs e)
        {
            deNgaythang.DateTime = DateTime.Now;
            loadCBB();
        }

        bool flag;
        private bool checkaaa()
        {
            if (txtDB.Text.Trim().Length < 5)
            {
                clsCommon.MsgBox("Giải đặc biệt bạn nhập chưa chính xác", 0);
                flag = false;
            }
            else if (txtNhat.Text.Trim().Length < 5)
            {
                clsCommon.MsgBox("Giải nhất bạn nhập chưa chính xác", 0);
                flag = false;
            }
            else if (txtNhi1.Text.Trim().Length < 5 || txtNhi2.Text.Trim().Length < 5)
            {
                clsCommon.MsgBox("Giải nhì bạn nhập chưa chính xác", 0);
                flag = false;
            }
            else if (txtBa1.Text.Trim().Length < 5 || txtBa2.Text.Trim().Length < 5 || txtBa3.Text.Trim().Length < 5 || txtBa4.Text.Trim().Length < 5 || txtBa5.Text.Trim().Length < 5 || txtBa6.Text.Trim().Length < 5)
            {
                clsCommon.MsgBox("Giải ba bạn nhập chưa chính xác", 0);
                flag = false;
            }
            else if (txtTu1.Text.Trim().Length < 4 || txtTu2.Text.Trim().Length < 4 || txtTu3.Text.Trim().Length < 4 || txtTu4.Text.Trim().Length < 4)
            {
                clsCommon.MsgBox("Giải tư bạn nhập chưa chính xác", 0);
                flag = false;
            }
            else if (txtNam1.Text.Trim().Length < 4 || txtNam2.Text.Trim().Length < 4 || txtNam3.Text.Trim().Length < 4 || txtNam4.Text.Trim().Length < 4 || txtNam5.Text.Trim().Length < 4 || txtNam6.Text.Trim().Length < 4)
            {
                clsCommon.MsgBox("Giải năm bạn nhập chưa chính xác", 0);
                flag = false;
            }
            else if (txtSau1.Text.Trim().Length < 3 || txtSau2.Text.Trim().Length < 3 || txtSau3.Text.Trim().Length < 3)
            {
                clsCommon.MsgBox("Giải sáu bạn nhập chưa chính xác", 0);
                flag = false;
            }
            else if (txtSau1.Text.Trim().Length < 3 || txtSau2.Text.Trim().Length < 3 || txtSau3.Text.Trim().Length < 3)
            {
                clsCommon.MsgBox("Giải sáu bạn nhập chưa chính xác", 0);
                flag = false;
            }
            else if (txtBay1.Text.Trim().Length < 2 || txtBay2.Text.Trim().Length < 2 || txtBay3.Text.Trim().Length < 2 || txtBay4.Text.Trim().Length < 2)
            {
                clsCommon.MsgBox("Giải bẩy bạn nhập chưa chính xác", 0);
                flag = false;
            }
            else
            {
                flag = true;
            }
            return flag;
        }

        private void checkHang(DateTime ngaythang)
        {
            SqlConnection conn = new SqlConnection(BienTc.connString);
            if (conn.State == ConnectionState.Closed)
            {
                conn.Open();
            }
            try
            {
                SqlDataAdapter da = new SqlDataAdapter("Select * from rutthuong Where datepart(day,Ngay_MoThuong)=" + ngaythang.Day + " and datepart(month,Ngay_MoThuong)=" + ngaythang.Month + " and datepart(year,Ngay_MoThuong)=" + ngaythang.Year + "", conn);
                DataTable dt = new DataTable();
                da.Fill(dt);
                if (dt.Rows.Count == 0)
                {
                    SqlCommand cmd = new SqlCommand("Insert into rutthuong(Ngay_Mothuong) values(@ngay)", conn);
                    cmd.Parameters.AddWithValue("@ngay", ngaythang);
                    cmd.ExecuteNonQuery();
                }
            }
            catch
            {
            }
        }

        private void labelControl6_Click(object sender, EventArgs e)
        {

        }

        private void loadCBB()
        {
            SqlConnection conn = new SqlConnection(BienTc.connString);
            conn.Open();

            SqlDataAdapter da = null;
            da = new SqlDataAdapter("Select * from DMDONVI Where isPublic=1", conn);
            DataTable dt = new DataTable();
            da.Fill(dt);
            lueDonVi.Properties.DataSource = dt;
            if (dt.Rows.Count > 0)
            {
                lueDonVi.ItemIndex = 0;
            }
        }

        private void simpleButton4_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void btnTonghop_Click(object sender, EventArgs e)
        {
            frmBangTongHop frm = new frmBangTongHop();
            frm.ShowDialog();
        }

        private void textEdit11_EditValueChanged(object sender, EventArgs e)
        {

        }

        private void txtDB_EditValueChanged(object sender, EventArgs e)
        {
            if (txtDB.Text.Trim().Length == 5)
            {
                txtNhat.Focus();
            }
        }

        private void txtNhat_EditValueChanged(object sender, EventArgs e)
        {
            if (txtNhat.Text.Trim().Length == 5)
            {
                txtNhi1.Focus();
            }
        }

        private void txtNhi1_EditValueChanged(object sender, EventArgs e)
        {
            if (txtNhi1.Text.Trim().Length == 5)
            {
                txtNhi2.Focus();
            }
        }

        private void txtNhi2_EditValueChanged(object sender, EventArgs e)
        {
            if (txtNhi2.Text.Trim().Length == 5)
            {
                txtBa1.Focus();
            }
        }

        private void txtBa1_EditValueChanged(object sender, EventArgs e)
        {
            if (txtBa1.Text.Trim().Length == 5)
            {
                txtBa2.Focus();
            }
        }

        private void txtBa2_EditValueChanged(object sender, EventArgs e)
        {
            if (txtBa2.Text.Trim().Length == 5)
            {
                txtBa3.Focus();
            }
        }

        private void txtBa3_EditValueChanged(object sender, EventArgs e)
        {
            if (txtBa3.Text.Trim().Length == 5)
            {
                txtBa4.Focus();
            }
        }

        private void txtBa4_EditValueChanged(object sender, EventArgs e)
        {
            if (txtBa4.Text.Trim().Length == 5)
            {
                txtBa5.Focus();
            }
        }

        private void txtBa5_EditValueChanged(object sender, EventArgs e)
        {
            if (txtBa5.Text.Trim().Length == 5)
            {
                txtBa6.Focus();
            }
        }

        private void txtBa6_EditValueChanged(object sender, EventArgs e)
        {
            if (txtBa6.Text.Trim().Length == 5)
            {
                txtTu1.Focus();
            }
        }

        private void txtTu1_EditValueChanged(object sender, EventArgs e)
        {
            if (txtTu1.Text.Trim().Length == 4)
            {
                txtTu2.Focus();
            }
        }

        private void txtTu3_EditValueChanged(object sender, EventArgs e)
        {
            if (txtTu3.Text.Trim().Length == 4)
            {
                txtTu4.Focus();
            }
        }

        private void txtTu4_EditValueChanged(object sender, EventArgs e)
        {
            if (txtTu4.Text.Trim().Length == 4)
            {
                txtNam1.Focus();
            }
        }

        private void txtNam1_EditValueChanged(object sender, EventArgs e)
        {
            if (txtNam1.Text.Trim().Length == 4)
            {
                txtNam2.Focus();
            }
        }

        private void txtNam2_EditValueChanged(object sender, EventArgs e)
        {
            if (txtNam2.Text.Trim().Length == 4)
            {
                txtNam3.Focus();
            }
        }

        private void txtNam3_EditValueChanged(object sender, EventArgs e)
        {
            if (txtNam3.Text.Trim().Length == 4)
            {
                txtNam4.Focus();
            }
        }

        private void txtNam4_EditValueChanged(object sender, EventArgs e)
        {
            if (txtNam4.Text.Trim().Length == 4)
            {
                txtNam5.Focus();
            }
        }

        private void txtNam5_EditValueChanged(object sender, EventArgs e)
        {
            if (txtNam5.Text.Trim().Length == 4)
            {
                txtNam6.Focus();
            }
        }

        private void txtNam6_EditValueChanged(object sender, EventArgs e)
        {
            if (txtNam6.Text.Trim().Length == 4)
            {
                txtSau1.Focus();
            }
        }

        private void txtSau1_EditValueChanged(object sender, EventArgs e)
        {
            if (txtSau1.Text.Trim().Length == 3)
            {
                txtSau2.Focus();
            }
        }

        private void txtSau2_EditValueChanged(object sender, EventArgs e)
        {
            if (txtSau2.Text.Trim().Length == 3)
            {
                txtSau3.Focus();
            }
        }

        private void txtSau3_EditValueChanged(object sender, EventArgs e)
        {
            if (txtSau3.Text.Trim().Length == 3)
            {
                txtBay1.Focus();
            }
        }

        private void txtBay1_EditValueChanged(object sender, EventArgs e)
        {
            if (txtBay1.Text.Trim().Length == 2)
            {
                txtBay2.Focus();
            }
        }

        private void txtBay2_EditValueChanged(object sender, EventArgs e)
        {
            if (txtBay2.Text.Trim().Length == 2)
            {
                txtBay3.Focus();
            }
        }

        private void txtBay3_EditValueChanged(object sender, EventArgs e)
        {
            if (txtBay3.Text.Trim().Length == 2)
            {
                txtBay4.Focus();
            }
        }

        private void txtBay4_EditValueChanged(object sender, EventArgs e)
        {

        }

        private void deNgaythang_EditValueChanged(object sender, EventArgs e)
        {
            checkHang(deNgaythang.DateTime);
            loadData(deNgaythang.DateTime);
        }

        private void loadData(DateTime ngaythang)
        {
            SqlConnection conn = new SqlConnection(BienTc.connString);
            if (conn.State == ConnectionState.Closed)
            {
                conn.Open();
            }
            try
            {
                SqlDataAdapter da = new SqlDataAdapter("Select * from rutthuong Where datepart(day,Ngay_MoThuong)=" + ngaythang.Day + " and datepart(month,Ngay_MoThuong)=" + ngaythang.Month + " and datepart(year,Ngay_MoThuong)=" + ngaythang.Year + "", conn);
                DataTable dt = new DataTable();
                da.Fill(dt);
                if (dt.Rows.Count > 0)
                {
                    foreach (DataRow row in dt.Rows)
                    {
                        txtDB.Text = row["Giai_DB"].ToString();
                        txtNhat.Text = row["Giai_Nhat"].ToString();
                        string nhi = row["Giai_Nhi"].ToString();
                        string nhi1 = "";
                        string nhi2 = "";
                        bool flag_nhi = true;
                        foreach (char c in nhi)
                        {
                            if (c.ToString().CompareTo(",") != 0)
                            {
                                if (flag_nhi)
                                {
                                    nhi1 += c;
                                }
                            }
                            else
                            {
                                flag_nhi = false;
                            }
                            if (flag_nhi == false)
                            {
                                if (c.ToString().CompareTo(",") != 0)
                                {
                                    nhi2 += c;
                                }
                            }
                        }
                        txtNhi1.Text = nhi1;
                        txtNhi2.Text = nhi2;

                        string ba = row["Giai_Ba"].ToString();
                        string ba1 = "";
                        string ba2 = "";
                        string ba3 = "";
                        string ba4 = "";
                        string ba5 = "";
                        string ba6 = "";
                        int type = 1;
                        foreach (char c in ba)
                        {
                            if (type == 1)
                            {
                                if (c.ToString().CompareTo(",") != 0)
                                {
                                    ba1 += c;
                                }
                                else
                                {
                                    type = 2;
                                }
                            }
                            else if (type == 2)
                            {
                                if (c.ToString().CompareTo(",") != 0)
                                {
                                    ba2 += c;
                                }
                                else
                                {
                                    type = 3;
                                }
                            }
                            else if (type == 3)
                            {
                                if (c.ToString().CompareTo(",") != 0)
                                {
                                    ba3 += c;
                                }
                                else
                                {
                                    type = 4;
                                }
                            }
                            else if (type == 4)
                            {
                                if (c.ToString().CompareTo(",") != 0)
                                {
                                    ba4 += c;
                                }
                                else
                                {
                                    type = 5;
                                }
                            }
                            else if (type == 5)
                            {
                                if (c.ToString().CompareTo(",") != 0)
                                {
                                    ba5 += c;
                                }
                                else
                                {
                                    type = 6;
                                }
                            }
                            else
                            {
                                ba6 += c;
                            }                            
                        }
                        txtBa1.Text = ba1;
                        txtBa2.Text = ba2;
                        txtBa3.Text = ba3;
                        txtBa4.Text = ba4;
                        txtBa5.Text = ba5;
                        txtBa6.Text = ba6;

                        string tu = "";
                        tu = row["Giai_Tu"].ToString();
                        string tu1 = "";
                        string tu2 = "";
                        string tu3 = "";
                        string tu4 = "";
                        int type_tu = 1;
                        foreach (char c in tu)
                        {
                            if (type_tu == 1)
                            {
                                if (c.ToString().CompareTo(",") != 0)
                                {
                                    tu1 += c;
                                }
                                else
                                {
                                    type_tu = 2;
                                }
                            }
                            else if (type_tu == 2)
                            {
                                if (c.ToString().CompareTo(",") != 0)
                                {
                                    tu2 += c;
                                }
                                else
                                {
                                    type_tu = 3;
                                }
                            }
                            else if (type_tu == 3)
                            {
                                if (c.ToString().CompareTo(",") != 0)
                                {
                                    tu3 += c;
                                }
                                else
                                {
                                    type_tu = 4;
                                }
                            }
                            else
                            {
                                tu4 += c;
                            }                            
                        }
                        txtTu1.Text = tu1;
                        txtTu2.Text = tu2;
                        txtTu3.Text = tu3;
                        txtTu4.Text = tu4;

                        string nam = "";
                        nam = row["Giai_Nam"].ToString();
                        string nam1 = "";
                        string nam2 = "";
                        string nam3 = "";
                        string nam4 = "";
                        string nam5 = "";
                        string nam6 = "";
                        int type_nam = 1;
                        foreach (char c in nam)
                        {
                            if (type_nam == 1)
                            {
                                if (c.ToString().CompareTo(",") != 0)
                                {
                                    nam1 += c;
                                }
                                else
                                {
                                    type_nam = 2;
                                }
                            }
                            else if (type_nam == 2)
                            {
                                if (c.ToString().CompareTo(",") != 0)
                                {
                                    nam2 += c;
                                }
                                else
                                {
                                    type_nam = 3;
                                }
                            }
                            else if (type_nam == 3)
                            {
                                if (c.ToString().CompareTo(",") != 0)
                                {
                                    nam3 += c;
                                }
                                else
                                {
                                    type_nam = 4;
                                }
                            }
                            else if (type_nam == 4)
                            {
                                if (c.ToString().CompareTo(",") != 0)
                                {
                                    nam4 += c;
                                }
                                else
                                {
                                    type_nam = 5;
                                }
                            }
                            else if (type_nam == 5)
                            {
                                if (c.ToString().CompareTo(",") != 0)
                                {
                                    nam5 += c;
                                }
                                else
                                {
                                    type_nam = 6;
                                }
                            }
                            else
                            {
                                nam6 += c;
                            }                            
                        }
                        txtNam1.Text = nam1;
                        txtNam2.Text = nam2;
                        txtNam3.Text = nam3;
                        txtNam4.Text = nam4;
                        txtNam5.Text = nam5;
                        txtNam6.Text = nam6;

                        string sau = "";
                        sau = row["Giai_Sau"].ToString();
                        string sau1 = "";
                        string sau2 = "";
                        string sau3 = "";
                        int type_sau = 1;
                        foreach (char c in sau)
                        {
                            if (type_sau == 1)
                            {
                                if (c.ToString().CompareTo(",") != 0)
                                {
                                    sau1 += c;
                                }
                                else
                                {
                                    type_sau = 2;
                                }
                            }
                            else if (type_sau == 2)
                            {
                                if (c.ToString().CompareTo(",") != 0)
                                {
                                    sau2 += c;
                                }
                                else
                                {
                                    type_sau = 3;
                                }
                            }
                            else
                            {
                                sau3 += c;
                            }                            
                        }
                        txtSau1.Text = sau1;
                        txtSau2.Text = sau2;
                        txtSau3.Text = sau3;

                        string bay = "";
                        bay = row["Giai_Bay"].ToString();
                        string bay1 = "";
                        string bay2 = "";
                        string bay3 = "";
                        string bay4 = "";
                        int type_bay = 1;
                        foreach (char c in bay)
                        {
                            if (type_bay == 1)
                            {
                                if (c.ToString().CompareTo(",") != 0)
                                {
                                    bay1 += c;
                                }
                                else
                                {
                                    type_bay = 2;
                                }
                            }
                            else if (type_bay == 2)
                            {
                                if (c.ToString().CompareTo(",") != 0)
                                {
                                    bay2 += c;
                                }
                                else
                                {
                                    type_bay = 3;
                                }
                            }
                            else if (type_bay == 3)
                            {
                                if (c.ToString().CompareTo(",") != 0)
                                {
                                    bay3 += c;
                                }
                                else
                                {
                                    type_bay = 4;
                                }
                            }
                            else
                            {
                                bay4 += c;
                            }                                                      
                        }
                        txtBay1.Text = bay1;
                        txtBay2.Text = bay2;
                        txtBay3.Text = bay3;
                        txtBay4.Text = bay4; 


                        da = new SqlDataAdapter("Select * from DSHD_HUYVE Where isPublic=1", conn);
                        DataTable dt1 = new DataTable();
                        da.Fill(dt1);
                        lueCATinh.Properties.DataSource = dt1;
                        lueCTY.Properties.DataSource = dt1;
                        lueMT_TQ.Properties.DataSource = dt1;
                        luePCT.Properties.DataSource = dt1;
                        lueSoTC.Properties.DataSource = dt1;
                        lueSoTP.Properties.DataSource = dt1;
                        lueThuKy.Properties.DataSource = dt1;
                        lueTTRA.Properties.DataSource = dt1;

                        if (dt1.Rows.Count > 0)
                        {
                            lueCATinh.ItemIndex = lueCATinh.Properties.GetDataSourceRowIndex("CA_TINH", row["CA_TINH"]);
                            lueCTY.ItemIndex = lueCATinh.Properties.GetDataSourceRowIndex("CTY_XSKT", row["CTY_XSKT"]);
                            lueMT_TQ.ItemIndex = lueCATinh.Properties.GetDataSourceRowIndex("MATTRAN_TQ", row["MATTRAN_TQ"]);
                            luePCT.ItemIndex = lueCATinh.Properties.GetDataSourceRowIndex("PCT_HD", row["PCT_HD"]);
                            lueSoTC.ItemIndex = lueCATinh.Properties.GetDataSourceRowIndex("SO_TC", row["SO_TC"]);
                            lueSoTP.ItemIndex = lueCATinh.Properties.GetDataSourceRowIndex("SO_TP", row["SO_TP"]);
                            lueThuKy.ItemIndex = lueCATinh.Properties.GetDataSourceRowIndex("THU_KY", row["THU_KY"]);
                            lueTTRA.ItemIndex = lueCATinh.Properties.GetDataSourceRowIndex("TTRA_NN", row["TTRA_NN"]);
                        }
                    }
                }
            }
            catch
            {
            }
        }

        private void btnChon_Click(object sender, EventArgs e)
        {
            SqlConnection conn = new SqlConnection(BienTc.connString);
            if (conn.State == ConnectionState.Closed)
            {
                conn.Open();
            }
            try
            {
                if (checkaaa())
                {
                    string giaidb = "";
                    string giainhat = "";
                    string giainhi = "";
                    string giaiba = "";
                    string giaitu = "";
                    string giainam = "";
                    string giaisau = "";
                    string giaibay = "";

                    giaidb = txtDB.Text;
                    giainhat = txtNhat.Text;
                    giainhi = txtNhi1.Text + "," + txtNhi2.Text;
                    giaiba = txtBa1.Text + "," + txtBa2.Text + "," + txtBa3.Text + "," + txtBa4.Text + "," + txtBa5.Text + "," + txtBa6.Text;
                    giaitu = txtTu1.Text + "," + txtTu2.Text + "," + txtTu3.Text + "," + txtTu4.Text;
                    giainam = txtNam1.Text + "," + txtNam2.Text + "," + txtNam3.Text + "," + txtNam4.Text + "," + txtNam5.Text + "," + txtNam6.Text;
                    giaisau = txtSau1.Text + "," + txtSau2.Text + "," + txtSau3.Text;
                    giaibay = txtBay1.Text + "," + txtBay2.Text + "," + txtBay3.Text + "," + txtBay4.Text;

                    SqlCommand cmd = new SqlCommand(@"UPDATE [RUTTHUONG]
                   SET [Ma_DMDonVi] = @Ma_DMDonVi
                      ,[Giai_DB] = @Giai_DB
                      ,[Giai_Nhat] = @Giai_Nhat
                      ,[Giai_Nhi] = @Giai_Nhi
                      ,[Giai_Ba] = @Giai_Ba
                      ,[Giai_Tu] = @Giai_Tu
                      ,[Giai_Nam] = @Giai_Nam
                      ,[Giai_Sau] = @Giai_Sau
                      ,[Giai_Bay] = @Giai_Bay
                      ,[PCT_HD] = @PCT_HD
                      ,[CTY_XSKT] = @CTY_XSKT
                      ,[SO_TC] = @SO_TC
                      ,[TTRA_NN] = @TTRA_NN
                      ,[SO_TP] = @SO_TP
                      ,[CA_TINH] = @CA_TINH
                      ,[MATTRAN_TQ] = @MATTRAN_TQ
                      ,[THU_KY] = @THU_KY                    
                 WHERE datepart(day,Ngay_MoThuong)=" + deNgaythang.DateTime.Day + " and datepart(month,Ngay_MoThuong)=" + deNgaythang.DateTime.Month + " and datepart(year,Ngay_MoThuong)=" + deNgaythang.DateTime.Year + "", conn);
                    cmd.Parameters.AddWithValue("@Ma_DMDonVi", lueDonVi.GetColumnValue("Ma_DT"));
                    cmd.Parameters.AddWithValue("@Giai_DB", giaidb);
                    cmd.Parameters.AddWithValue("@Giai_Nhat", giainhat);
                    cmd.Parameters.AddWithValue("@Giai_Nhi", giainhi);
                    cmd.Parameters.AddWithValue("@Giai_Ba", giaiba);
                    cmd.Parameters.AddWithValue("@Giai_Tu", giaitu);
                    cmd.Parameters.AddWithValue("@Giai_Nam", giainam);
                    cmd.Parameters.AddWithValue("@Giai_Sau", giaisau);
                    cmd.Parameters.AddWithValue("@Giai_Bay", giaibay);
                    cmd.Parameters.AddWithValue("@PCT_HD", luePCT.GetColumnValue("PCT_HD"));
                    cmd.Parameters.AddWithValue("@CTY_XSKT", lueCTY.GetColumnValue("CTY_XSKT"));
                    cmd.Parameters.AddWithValue("@SO_TC", lueSoTC.GetColumnValue("SO_TC"));
                    cmd.Parameters.AddWithValue("@TTRA_NN", lueTTRA.GetColumnValue("TTRA_NN"));
                    cmd.Parameters.AddWithValue("@SO_TP", lueSoTP.GetColumnValue("SO_TP"));
                    cmd.Parameters.AddWithValue("@CA_TINH", lueCATinh.GetColumnValue("CA_TINH"));
                    cmd.Parameters.AddWithValue("@MATTRAN_TQ", lueMT_TQ.GetColumnValue("MATTRAN_TQ"));
                    cmd.Parameters.AddWithValue("@THU_KY", lueThuKy.GetColumnValue("THU_KY"));
                    cmd.ExecuteNonQuery();
                    clsCommon.MsgBox("Lưu thành công", 1);
                }
            }
            catch
            {                                
            }            
        }

        private void txtTu2_EditValueChanged(object sender, EventArgs e)
        {
            if (txtTu2.Text.Trim().Length == 4)
            {
                txtTu3.Focus();
            }
        }

        private void btnchitiet_Click(object sender, EventArgs e)
        {
            DateTime Ngaythang = deNgaythang.DateTime;
            prjKQXS_Report.rptBienBanVeThuong rpt = new prjKQXS_Report.rptBienBanVeThuong(Ngaythang);
            rpt.ShowRibbonPreviewDialog();
        }

        private void btnIn_Click(object sender, EventArgs e)
        {

        }
    }
}